import request from '@/utils/request'

const BASE_URL = '/v1/role'

export function commonQuery(RoleDTOs) {
  return request({
    url: BASE_URL,
    method: 'get',
    params: RoleDTOs
  })
}

export function add(RoleDTO) {
  return request({
    url: BASE_URL,
    method: 'post',
    data: RoleDTO
  })
}

export function remove(RoleDTO) {
  return request({
    url: BASE_URL,
    method: 'delete',
    params: RoleDTO
  })
}

export function batchRemove(RoleDTOs) {
  return request({
    url: BASE_URL + '/batch',
    method: 'delete',
    data: RoleDTOs
  })
}

export function queryRoleById(id) {
  return request({
    url: BASE_URL + '/' + id,
    method: 'get'
  })
}

export function modify(id) {
  return request({
    url: BASE_URL,
    method: 'put',
    data: id
  })
}

export function commonQueryUser(userQuery) {
  return request({
    url: BASE_URL + '/commonQueryUser',
    method: 'get',
    params: userQuery
  })
}

export function assignUser(userRoleIdDTO) {
  return request({
    url: BASE_URL + '/assignUser',
    method: 'post',
    data: userRoleIdDTO
  })
}

export function modifyRoleCompany(roleCompanyDTO) {
  return request({
    url: BASE_URL + '/company',
    method: 'put',
    data: roleCompanyDTO
  })
}

export function assignResource(roleResourceDTO) {
  return request({
    url: BASE_URL + '/assignResource',
    method: 'post',
    data: roleResourceDTO
  })
}
